import threading
import time

g_num = 0
def test1(temp):
    global g_num
    for i in range(temp):
        g_num += 1
    print('__test1  %s' % g_num)

def test2(temp):
    
    global g_num
    for i in range(temp):
        g_num += 1
    print('__test2  %s' % g_num)


def main():

    t1 = threading.Thread(target=test1,args=(100,)) #  如果是次数更多的话，结果
                                                    #  差距更大
    t2 = threading.Thread(target=test2,args=(100,))
    t1.start()
    t2.start()

    time.sleep(5)
    print('__main  %s' % g_num)
if __name__ == '__main__':
    main()
